package com.example.cloudconsumerfeignorder80.contorller;

import com.example.cloudconsumerfeignorder80.client.PaymentClient;
import com.example.springcloud.entity.CommonResult;
import com.example.springcloud.entity.Payment;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author chensixiang chensixiang1234@gmail.com
 */
@RestController
@Slf4j
@RequiredArgsConstructor
@RequestMapping("/consumer")
public class OrderController {

    private final PaymentClient paymentClient;


    @PostMapping("/add")
    public CommonResult add(Payment payment) {
        return paymentClient.add(payment);
    }

    @GetMapping("/get/{id}")
    public CommonResult get(@PathVariable Long id) {
        return paymentClient.get(id);
    }

    @GetMapping("/timeout")
    public String timeout() {
        return paymentClient.timeout();
    }
}
